<div ng-controller="OrderPickedController as vm">
  <h1 class="page-title">已接运单<a class="btn pull-right" ng-href="/api/order/assigned/export">导出Excel</a></h1>
  <div class="well table-well">
    <div class="table-responsive">
      <table class="table table-striped table-bordered">
        <thead>
          <tr>
            <th>单号</th>
            <th>发布企业</th>
            <th>始发城市</th>
            <th>到达城市</th>
            <th>司机</th>
            <th>车辆</th>
            <th>状态</th>
            <th>#</th>
            
            
          </tr>
        </thead>
        <tbody>
          <tr ng-repeat="order in vm.orders">
            <td><a ng-click="vm.viewDetail(order.id)" >{{order.orderId}}</a></td>
            <td>{{order.shipper.enterpriseName}}</td>
            <td>{{order.fromCity}}</td>
            <td>{{order.toCity}}</td>
            <td>{{order.driver.name}}</td>
            <td>{{order.vehicle.vehicleNumber}}</td>
            <td ng-switch='order.status'>
              <div ng-switch-when="2">接单中</div>
              <div ng-switch-when="3">已接单</div>
              <div ng-switch-when="4">行驶中</div>
              <div ng-switch-when="5">已到达</div>
              <div ng-switch-when="6">已交单</div>
              <div ng-switch-when="7">开票中</div>
              <div ng-switch-when="8">已完成</div>

            </td>
            <td><a class="btn btn-primary btn-mini" ng-click="vm.viewDetail(order.id)">查看</a>
              <a ng-click="vm.confirm(order.id)" class="btn btn-mini btn-danger" ng-show="vm.userRole!='carrier' && order.status==5 && vm.userRole!='revenuer'">确认交单</a>
            <a ng-show="order.status>3" id="map_{{order.orderId}}_{{order.vehicle.id}}" onclick='openWindow(this.id)'  class="btn btn-mini btn-info">查看地图</a>
                <a ng-show="order.status>3" ng-href="/api/location/export/order/{{order.orderId}}"  class="btn btn-mini btn-info">导出数据</a>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <p ng-show="vm.noRecord">没有找到符合条件的数据！</p>
  </div>
  <div class="pagination pagination-centered" ng-show="!vm.noRecord">
    <ul>
      <li ng-class="vm.firstPage? 'disabled':''" ng-switch="vm.firstPage">
        <a ng-switch-when="false" ng-click="vm.loadPage(vm.currentPage-1)" >&laquo;</a>
        <a ng-switch-when="true" >&laquo;</a>
      </li>
      <li ng-repeat="me in vm.pages" ng-class="me==vm.currentPage? 'active':''" ng-switch="me==vm.currentPage">
        <a ng-switch-when="false" ng-click="vm.loadPage(me)" >{{me}}</a>
        <a ng-switch-when="true" >{{me}}</a>
      </li>
      <li ng-class="vm.lastPage? 'disabled':''" ng-switch on="vm.lastPage">
        <a ng-switch-when="false" ng-click="vm.loadPage(vm.currentPage+1)">&raquo;</a>
        <a ng-switch-when="true" >&raquo;</a>
      </li>
    </ul>
  </div>
</div>
 <script>
    function openWindow(oid)
    {
        oid = oid.replace("map_","");
        var ids = oid.split("_");
        var orderId = ids[0];
        var vehicleId = ids[1];
        var url = "../views/map/map.html?id="+ orderId + "&vid="+vehicleId;
        var child = window.open(url ,"运单路线","width=800,height=600,toolbar=no,scrollbars=no,menubar=no,screenX=100,screenY=50");
    }
</script>